package com.ruoyi.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.domain.BorrowingAmount;
import com.ruoyi.mapper.BorrowingAmountMapper;
import com.ruoyi.service.IBorrowingAmountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 借款Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-16
 */
@Service
public class BorrowingAmountServiceImpl implements IBorrowingAmountService 
{
    @Autowired
    private BorrowingAmountMapper borrowingAmountMapper;

    /**
     * 查询借款
     * 
     * @param bId 借款ID
     * @return 借款
     */
    @Override
    public BorrowingAmount selectBorrowingAmountById(Long bId)
    {
        return borrowingAmountMapper.selectBorrowingAmountById(bId);
    }

    /**
     * 查询借款列表
     * 
     * @param borrowingAmount 借款
     * @return 借款
     */
    @Override
    public List<BorrowingAmount> selectBorrowingAmountList(BorrowingAmount borrowingAmount)
    {
        return borrowingAmountMapper.selectBorrowingAmountList(borrowingAmount);
    }


    /**
     * 财务查询借款列表
     *
     * @param borrowingAmount 借款
     * @return 借款
     */
    @Override
    public List<BorrowingAmount> selectBorrowingAmountLists(BorrowingAmount borrowingAmount)
    {
        return borrowingAmountMapper.selectBorrowingAmountLists(borrowingAmount);
    }

    /**
     * 新增借款
     * 
     * @param borrowingAmount 借款
     * @return 结果
     */
    @Override
    public int insertBorrowingAmount(BorrowingAmount borrowingAmount)
    {
        //获取时间
        borrowingAmount.setbTime(new Date());
        return borrowingAmountMapper.insertBorrowingAmount(borrowingAmount);
    }

    /**
     * 修改借款
     * 
     * @param borrowingAmount 借款
     * @return 结果
     */
    @Override
    public int updateBorrowingAmount(BorrowingAmount borrowingAmount)
    {
        return borrowingAmountMapper.updateBorrowingAmount(borrowingAmount);
    }

    /**
     * 删除借款对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBorrowingAmountByIds(String ids)
    {
        return borrowingAmountMapper.deleteBorrowingAmountByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除借款信息
     * 
     * @param bId 借款ID
     * @return 结果
     */
    @Override
    public int deleteBorrowingAmountById(Long bId)
    {
        return borrowingAmountMapper.deleteBorrowingAmountById(bId);
    }

    /**
     * 提交审批
     * @param bId
     * @return
     */
    @Override
    public int submitExaStatus(Long bId) {
        return borrowingAmountMapper.submitExaStatus(bId);
    }

    /**
     * 撤销
     * @param bId
     * @return
     */
    @Override
    public int revoExaStatus(Long bId) {
        return borrowingAmountMapper.revoExaStatus(bId);
    }

    /**
     * 结束
     * @param bId
     * @return
     */
    @Override
    public int overExaStatus(Long bId) {
        return borrowingAmountMapper.overExaStatus(bId);
    }

    /**
     * 总经理通过审批
     * @param bId
     * @return
     */
    @Override
    public int conExaStatus(Long bId) {
        return borrowingAmountMapper.conExaStatus(bId);
    }

    /**
     * 驳回
     * @param bId
     * @return
     */
    @Override
    public int editparoStatus(Long bId) {
        return borrowingAmountMapper.editparoStatus(bId);
    }

    /**
     * 财务处理
     * @param bId
     * @return
     */
    @Override
    public int consExaStatus(Long bId) {
        return borrowingAmountMapper.consExaStatus(bId);
    }

    /**
     * 按姓名查询借款金额
     */
    @Override
    public List<BorrowingAmount> selectPriceByLoginName(String bApplicant) {
        return borrowingAmountMapper.selectPriceByLoginName(bApplicant);
    }
}
